package com.jrx.anytxn.common.exception;

/**
 * 通过BeanMapping做属性值拷贝发生的异常
 * @author zhangyingxuan
 * @date 2018-08-10
 */
public class TxnBeanMappingException extends RuntimeException{

	private static final long serialVersionUID = -8864724115355669187L;
	private int errCode = 9999;

	private String errMsg = "对象映射出错";

	public TxnBeanMappingException(){
		super();
	}

	public TxnBeanMappingException(int errCode){
		super("errCode:"+errCode);
		this.errCode = errCode;
	}

	public TxnBeanMappingException(String errMsg){
		super(errMsg);
		this.errMsg = errMsg;
	}

	public TxnBeanMappingException(int errCode, String errMsg){
		super(errMsg);
		this.errCode = errCode;
		this.errMsg = errMsg;
	}

	public TxnBeanMappingException(Throwable cause){
		super(cause);
		if(cause!=null){
			this.errMsg = cause.getMessage();
		}
	}

	public TxnBeanMappingException(int errCode, Throwable cause){
		super(cause);
		this.errCode = errCode;
		if(cause!=null){
			this.errMsg = cause.getMessage();
		}
	}

	public int getErrCode() {
		return errCode;
	}

	public void setErrCode(int errCode) {
		this.errCode = errCode;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	@Override
	public String toString() {
        String builder = "{\"errCode\"=\"" +
                errCode +
                "\", \"errMsg\"=\"" +
                errMsg +
                "\"}";
        return builder;
	}

	
}
